home *** CD-ROM | disk | FTP | other *** search
/ Hyper Stacks 1994 May / Hyper Stacks (Pacific HiTech)(1994)[Mac].iso / Magazines / Windoid 1.5 / wind3.txt next >
Encoding:
Text File  |  1988-01-03  |  20.3 KB  |  562 lines  |  [TEXT/MACA]

  1. Article 22 of comp.sys.mac.hypercard:
  2. Path: ucbvax!decvax!decwrl!pyramid!voder!apple!hyperbug
  3. From: hyperbug@apple.UUCP (Keith Rollin)
  4. Newsgroups: comp.sys.mac.hypercard,comp.sys.mac
  5. Subject: Windoid #3
  6. Keywords: Hypercard windoid newsletter
  7. Message-ID: <6586@apple.UUCP>
  8. Date: 30 Oct 87 22:23:47 GMT
  9. Organization: Apple Computer, Inc., Cupertino, USA
  10. Lines: 546
  11. Xref: ucbvax comp.sys.mac.hypercard:22 comp.sys.mac:8944
  12.  
  13.  
  14.  
  15.  
  16.                                      WINDOID
  17.                                     Issue  #3
  18.                   The Publication for the Informed HyperCard User
  19.                               Editor:  David Leffler
  20.  
  21. Contents:
  22. INTRODUCTION
  23. EDITOR'S CHOICE
  24. HYPERCARD USER TIPS
  25. UNIVERSAL IMPORT BUTTON
  26. WHOOPS!
  27. THE FORM
  28.  
  29. In this third issue of WINDOID, we will continue to cover importing text into
  30. HyperCard. Gary Bond, one of Apples outstanding HyperCard test team members,
  31. wrote a universal import button that takes into consideration nearly
  32. everything. You can now create a button that imports MacWrite, Microsoft
  33. Word, many database files, and even HyperCard stacks! We think you are going
  34. to enjoy this.
  35. Phil Wyman, another excellent Apple HyperCard tester, has provided us with more
  36. of his highly acclaimed power-user tips and has taken a stab at explaining some
  37. of the more interesting aspects of HyperCard properties.
  38. In the two previous issues, there were some mistakes. I would like to apologize
  39. for any inconvenience or frustration they might have caused and rectify them.
  40. The errata will appear on page seven under WHOOPS. I generally get all the text
  41. stuffed into the WINDOID newsletter moments before the Thursday meeting, and
  42. sometimes I miss something. Many of the excellent scripters that avidly read
  43. WINDOID have noticed my lapses and have provided me with needed repairs. For
  44. their kind assistance, I offer my thanks.
  45.  
  46. WINDOID provides an opportunity for its readers to contribute to the ongoing
  47. growth and excellence of HyperCard. With your assistance we can continue to
  48. bring to HyperCard added depth and functionality. In the back of every issue
  49. will be a form for you to keep by your Macintosh. This form will allow you the
  50. unique opportunity to participate directly in the continued development of
  51. HyperCard.
  52.  
  53. We will read all the forms returned and address questions that are being asked
  54. by HyperCard users. We will ask the team and provide you with an answer and
  55. publish the answers in this newsletter.  In this way we can gather information
  56. and provide for your needs in future versions of HyperCard.
  57.  
  58. WINDOID is trying to make a difference in the way that you work with HyperCard.
  59. We need your input.  What sort of stacks are you using, what kinds of stacks
  60. are you creating, and what are some of the joys and frustrations you are
  61. experiencing.  We really want to know!
  62.  
  63. If you have a bug, suggestion, comment, or just want to know the best way to do
  64. something in HyperCard, you can fill out the form and send it to:
  65.  
  66. AHUG c/o David Leffler
  67. Apple Computer, Inc.
  68. MS/27-AQ
  69. 20525 Mariani Ave.
  70. Cupertino, CA 95014
  71.  
  72. Or copy the format and Apple-Link it to:  HYPERBUG$
  73.  
  74.                                   EDITOR'S CHOICE
  75.                                  by  David Leffler
  76.  
  77. At the last Apple HyperCard User Group meeting , Danny Goodman, author of The
  78. Complete HyperCard Handbook, presented to an appreciative audience his
  79. incredible business productivity stack Focal Point. It will be released soon
  80. by Activision. We were all amazed at the incredible graphics and awesome
  81. features he has scripted into it. Danny, as you might know, is not a programmer
  82. and has always been frustrated by his inability to turn his ideas into
  83. software. HyperCard has empowered him to not only turn his ideas into reality,
  84. but to allow him the opportunity to share his ideas with the world. Thank you
  85. Danny!
  86.  
  87. Amanda Goodenough, author of the Inigo and My Favorite Camel series of
  88. wonderful adventures, was also on hand. Her obvious love of stories and great
  89. presentation style captivated the audience.  Amanda continues to enhance and
  90. produce more of these non-textual stories and has graciously allowed us to
  91. place them in an Amandas Stacks folder on the AHUG StackWare server. My
  92. Favorite Camel is a favorite of mine, and I think everyone should see it and
  93. share it with someone they love.
  94.  
  95. There are two other stacks on the StackWare server that also deserve serious
  96. attention. The AIDS stack is a perfect representation of how HyperCard can be
  97. used in an incredibly invocative eye and heart grabbing style. This stack is
  98. not only visually and emotionally gripping, but is an excellent  example of how
  99. to use HyperCard as a powerful vehicle to move you through diverse information.
  100. You should get this stack.
  101.  
  102. Finally, Tree Frog Studio software presents CheapSequencer.  Tree Frog has
  103. given us a music sequencer that must be seen and heard to be believed. These
  104. innovative stackware developers are interested in entertaining us with great
  105. graphics and functional stackware tools.
  106. Its stacks and people like these that really show the power and versatility of
  107. HyperCard.
  108.  
  109.                                  POWERUSERS TIPS
  110.                                   by Phil Wyman
  111.  
  112. 1.  If you get tired of pulling the Tools Windoid off of the menubar when you
  113. need it, try Option-Tab, which will tear it off for you!  Also, if the Tools
  114. Windoid is in a paint tool,  hitting Tab will tear off the Patterns Windoid.
  115.  
  116. 2.  If you have a line in your script that is longer than the editor window,
  117. you can place an Option-Return at a space in the line to break it into two
  118. smaller lines.  The two lines will execute in the same way as the original
  119. line.  (Do not place the Option-Return into the middle of a quoted string.
  120. Also, if you use the Option-Return in a comment,  remember that every line of a
  121. comment must start with a double hyphen!)
  122.  
  123. 3.  For those programmers out there who are used to for next loops, there is
  124. a next repeat command in HyperTalk which works in a repeat loop a lot like a
  125. next command in a for next loop.  The next repeat command does not
  126. execute anything that follows it in the repeat loop, but rather starts
  127. executing at the beginning of the repeat loop.
  128. Also, if you wish to exit the repeat loop altogether, without executing anymore
  129. of the lines in  the repeat loop, then use exit repeat.
  130.  
  131. Note:
  132. If you want to exit the entire message handler from anywhere in the handler,
  133. use exit <handlername> (i.e., exit mouseup).
  134. If you wish to leave the handler but wish the current message to be sent on up
  135. the hierarchical path from where it is now, then use pass <handlername>.
  136.  
  137. 4.  When concatenating two strings,  you can add a space between the two
  138. strings by using two ampersands && instead of just one &.
  139.  
  140. 5.  A shorthand for button in HyperTalk is btn.  A shorthand for
  141. background is bkgnd.
  142.  
  143. 6.  You can copy buttons, fields, backgrounds or cards between stacks.  This is
  144. a very powerful feature of HyperCard.
  145.  
  146. 7.  For those of you with the regular size Mac Plus or Mac SE screens, try this
  147. for a thrill:
  148.       Set loc of cardWindow to 10,50
  149. You will see what people on large screens see all the time, a window title bar
  150. which states the pathname of the window you are viewing.  (To reset your
  151. cardWindow, Set loc of cardWindow to 0,0.)
  152.  
  153. 8.  If you are in any tool other than the Browse tool, you can return to the
  154. Browse tool by Command-Tab.
  155.  
  156. 9.  When you are in the Button tool, you can Command-Drag to create a new
  157. button.  Option-Drag on a button and you will drag a copy of the button.
  158.  
  159. 10.  A first attempt at a small treatise on the use of the,of, and () in
  160. HyperTalk:
  161.  
  162. In general, either the, of, or parentheses () are required to signal
  163. HyperTalk that a function or property is to be activated.
  164.  
  165.  
  166. PROPERTIES:
  167. With button, card, background, stack, and window properties, the is optional,
  168. but you need of. Also, properties never have parentheses. You can say:
  169.    put hilite of button 1
  170.    put the hilite of button 1
  171.  
  172. Since there is no of to activate it, you cannot say:
  173.       put the hilite button 1
  174.  
  175. If you are using a global or painting property, you need the, since there is
  176. no of to activate the property. For instance, you can say:
  177.    put the lockScreen
  178.    put the textAlign
  179.  
  180. However, you cannot put the property by saying:
  181.    put lockScreen
  182. because HyperCard will think you are using lockScreen as a variable, not a
  183. property.
  184.  
  185. FUNCTIONS:
  186.  
  187. Either the, of, or parentheses () are required with a function.
  188.  
  189. However, you cannot mix the with parentheses in a system function. For
  190. instance, you cannot say:
  191.    put the charToNum(a)
  192.  
  193.  You are allowed to say:
  194.    put the chartonum of a
  195.    put chartonum(a)
  196.    put the chartonum of (a)
  197.    If a system function has more than one argument, it will always require
  198. parentheses.  For user-defined functions, you must always use parentheses, even
  199. if there are no argumentsi.e., userFunction().
  200. If a function does not use of or (), then the is required! For example,
  201. date doesnt work without the, since there is not an of or () to
  202. activate the function. You can say:
  203.      put the date
  204.  
  205. But you cannot say:
  206.      put date
  207. because HyperTalk will assume that date is a variable. This concept of
  208. insisting on a the to activate the function allows for future expansion of
  209. more system functions, since system functions will not be able to collide with
  210. variables that users already have in their scripts.
  211.  
  212.                             The UNIVERSAL IMPORT BUTTON
  213.                                    by Gary Bond
  214.                                      Rev. 2.2
  215.  
  216. Last issue we dealt with importing text. While those approaches are reliable,
  217. they are also very slow and dont account for a number of problems that might
  218. occur along the way. Consistent with our goal to provide you with the best,
  219. this issue contains a script for a universal import button which does both
  220. kinds of import (text and data). To use it, type it into any button script.
  221.  
  222. In addition to importing text files it also imports Macwrite and Word documents
  223. and even Hypercard stacks! This version of the import button fixes bugs both in
  224. Hypercard and in previous button versions.
  225.  
  226.  
  227.  
  228. on mouseUp
  229.   global cardcount,startcard,memory,header
  230.   get userlevel
  231.   put it into item 1 of memory
  232.   set userlevel to 5
  233.   set lockmessages to true
  234.   set lockscreen to true
  235.   put short id of this card into startcard
  236.   answer Import text file as: with Data or Text or Cancel
  237.   if it is Cancel then Cleanexit
  238.   if it is Text then
  239.     answer Include header information in fields? with Yes or No
  240.     put it into header
  241.     Importext
  242.   else
  243.     Importdata
  244.   end if
  245.   go next card
  246.   Cleanexit Compact
  247. end mouseup
  248.  
  249. on importext
  250.   global cardcount,startcard,memory,header
  251.   put 0 into cardcount
  252.   repeat
  253.     ask Name or pathname of text file to import: with item 2 of memory
  254.     if short name of this stack is in it then
  255.       if , is not in memory then put , after memory
  256.       put it into item 2 of memory
  257.       answer Cant import current stack! with Ok
  258.       next repeat
  259.     end if
  260.     if it is empty then
  261.       Cleanexit
  262.     else
  263.       exit repeat
  264.     end if
  265.   end repeat
  266.   put it into filename
  267.   if , is not in memory then put , after memory
  268.   put it into item 2 of memory
  269.   set cursor to 4
  270.   open file filename
  271.   repeat
  272.     read from file filename for 16384
  273.     if it is empty and cardcount is 0 then
  274.       answer Could not find file:  & filename with Ok
  275.       close file filename
  276.       Cleanexit
  277.     end if
  278.     if it is empty then exit repeat
  279.     put return after it
  280.     domenu New card
  281.     add 1 to cardcount
  282.     domenu New field
  283.     set name of card field (number of card fields) to Import
  284.     set style of card field Import to scrolling
  285.     drag from the loc of card field Import to 0,62
  286.     drag from 190,100 to 512,342
  287.     if header is Yes then
  288.       put Characters: && number of chars in it & return & return before it
  289.       put Lines: && number of lines in it & return before it
  290.       put File: && filename & return before it
  291.       put Import card: && cardcount & return before it
  292.     end if
  293.     put it into card field Import
  294.   end repeat
  295.   close file filename
  296.   if header is Yes then
  297.     repeat until the short id of this card is startcard
  298.       put  of && cardcount after line 1 of card field Import
  299.       go previous card
  300.     end repeat
  301.   else
  302.     go card id startcard
  303.   end if
  304. end importext
  305.  
  306. on importdata
  307.   global filename,cardcount,startcard,memory,header
  308.   put empty into delimiters
  309.   put empty into filename
  310.   put 0 into cardcount
  311.   put 0 into limit
  312.   put 0 into fieldcount
  313.   repeat until delimiters is not empty
  314.     put 0 into nofields
  315.     answer Use Tab and Return as delimiters? with Yes or Other or
  316. Cancel
  317.     if it is Cancel then mouseup
  318.     if it is Yes then put 9,13 into delimiters
  319.     if it is Other then
  320.       repeat until ((item 1 of it > 0 and item 1 of it < 256)
  321.         and (item 2 of it > 0 and item 2 of it < 256)) or it is empty
  322.         ask Enter two comma separated Ascii delimiters: with empty
  323.         put it into delimiters
  324.       end repeat
  325.     end if
  326.   end repeat
  327.   if item 1 of delimiters is item 2 of delimiters then put 1 into nofields
  328.   answer Include header information in fields? with Yes or No
  329.   put it into header
  330.   repeat
  331.     ask Name or pathname of text file to import: with item 2 of memory
  332.     if short name of this stack is in it then
  333.       if , is not in memory then put , after memory
  334.       put it into item 2 of memory
  335.       answer Cant import current stack! with Ok
  336.       next repeat
  337.     end if
  338.     if it is empty then
  339.       if cardcount > 0 then
  340.         close file filename
  341.         CleanExit
  342.       end if
  343.       Importdata
  344.     else
  345.       exit repeat
  346.     end if
  347.   end repeat
  348.   put it into filename
  349.   if , is not in memory then put , after memory
  350.   put it into item 2 of memory
  351.   set cursor to 4
  352.   open file filename
  353.   repeat
  354.     read from file filename until (numtochar of item 2 of delimiters)
  355.     if it is empty and cardcount is 0 then
  356.       answer Could not find file:  & filename with Ok
  357.       close file filename
  358.       Cleanexit
  359.     end if
  360.     if it is empty then exit repeat
  361.     if chartonum(last character of it) is not item 2 of delimiters then
  362.       put item 2 of delimiters into temp
  363.       if temp is 9 then put Tab into temp
  364.       if temp is 13 then put Return into temp
  365.       answer Cant find record delimiter:  && temp with Ok
  366.       close file filename
  367.       cleanexit
  368.     end if
  369.     put empty into last character of it
  370.     if (numtochar of item 1 of delimiters) is not in it and nofields is 0 then
  371.       put item 1 of delimiters into temp
  372.       if temp is 9 then put Tab into temp
  373.       if temp is 13 then put Return into temp
  374.       answer Cant find field delimiter:  && temp with Help or Ok
  375.       if it is help then
  376.         answer Use double record delimiters for records... with Continue
  377.         answer with no field delimiters. Example: 13,13 with Ok
  378.       end if
  379.       close file filename
  380.       Cleanexit
  381.     end if
  382.     if (numtochar of item 1 of delimiters) is not , and nofields is 0 then
  383.       repeat until (numtochar of item 1 of delimiters) is not in it
  384.         put , into character offset((numtochar of item 1 of delimiters),it)
  385. of it
  386.       end repeat
  387.     end if
  388.     if cardcount is 0 then
  389.       domenu New background
  390.     else
  391.       domenu New card
  392.     end if
  393.     add 1 to cardcount
  394.     if nofields is 0 then
  395.       put the number of items in it into limit
  396.     else
  397.       put nofields into limit
  398.     end if
  399.     repeat with count = 1 to limit
  400.       if cardcount is 1 then
  401.         add 1 to fieldcount
  402.         if fieldcount < 125 then
  403.           domenu New field
  404.         else
  405.           answer No more fields can be created! with Ok
  406.           Cleanexit Compact
  407.         end if
  408.       end if
  409.       put Field & count into fieldname
  410.       set name of bkgnd field (number of bkgnd fields) to fieldname
  411.       set style of bkgnd field fieldname to scrolling
  412.       If nofields is 0 and header is Yes then
  413.         put Field && count && of && the number of items in it & return into
  414. bkgnd field fieldname
  415.         put Record && cardcount && of file: && filename & return & return
  416. after bkgnd field fieldname
  417.       end if
  418.       if nofields is 0 then
  419.         put item count of it & return after bkgnd field fieldname
  420.       else
  421.         put it & return after bkgnd field fieldname
  422.       end if
  423.     end repeat
  424.     choose browse tool
  425.   end repeat
  426.   close file filename
  427.   go card id startcard
  428. end importdata
  429.  
  430. on Cleanexit var
  431.   global memory
  432.   if param(1) is compact then
  433.     domenu Compact stack
  434.   end if
  435.   choose browse tool
  436.   set userlevel to item 1 of memory
  437.   set lockscreen to false
  438.   set lockmessages to false
  439.   exit to hypercard
  440. end Cleanexit
  441.  
  442. We hope that this script will aid in your productivity with HyperCard.  Please
  443. let us know how you like it.
  444.  
  445.  
  446.                                       WHOOPS
  447.                                  by David Leffler
  448.  
  449. An errata from the first two issues of WINDOID.
  450.  
  451. ISSUE #1:
  452.  
  453. In the first issue Gary Bond showed us how to find out which line of a
  454. scrolling field the user has clicked on. Apple employee Brian McGhie found a
  455. small flaw and wrote me the following letter:
  456.  
  457. The question was asked, How can I find out which line of a field a user has
  458. clicked in? The response was a method that would work in static fields, and
  459. then further developed into a method for scrolling fields. The function
  460. Clickline as given for scrolling windows only works if the scrolling field is
  461. (in pixels) an integer multiple of the textheight. A corrected version of
  462. Clickline appears below.
  463.  
  464. Function Clickline
  465.      return (trunc(((scroll of the target) 
  466.      + (item two of the clickloc) 
  467.      - (item two of the rect of the target)) 
  468.      div the textheight of the target) + one)
  469. End Clickline
  470.  
  471. The idea is to calculate the number of pixels from the top of the field to the
  472. position that you clicked on. So you take the number of pixels that have
  473. scrolled offscreen, and add in the vertical position of the mouseclick minus
  474. the vertical position of the top of the field. This sum is the total number of
  475. pixels from the logical top of the window not the visual top. Divide by the
  476. height of the font to get the number of lines. Since this number is not always
  477. an integer, truncate it. The result is a zero based count of lines. Add one and
  478. return the correct line number that was clicked in.
  479.  
  480. ISSUE #2:
  481.  
  482. Robin Shank provided us with a How to Program FunctionKeys in HyperTalk
  483. script. We left out a word, and the script will not work without it.  The
  484. script should read:
  485.  
  486. On functionkey whatkey
  487.    if whatkey is 6 then
  488.    type x with commandkey   Cut whatever is selected
  489.    domenu background        enter the background
  490.    type v with commandkey   Paste it
  491.    domenu background        leave the background
  492.      else
  493.         pass functionkey
  494.      end if
  495. end functionkey
  496.  
  497.  
  498. We hope you have enjoyed reading WINDOID and have found it to be interesting
  499. and informative. We care enough to take the time to give you the most
  500. up-to-date information about HyperCard, and we would like to make a request for
  501. a little of your time. There is a form that follows this editorial; please fill
  502. it out if you will. We are very interested in hearing from you. What sort of
  503. stacks are you using, what kind of stacks are you creating, and what are your
  504. joys and frustrations in using HyperCard.
  505. You have the unique opportunity to communicate directly with Bill, Dan, and the
  506. entire HyperCard development team. We really want to know what you would like
  507. to see in HyperCard and are more than willing to give you what you want. What
  508. we need to make this happen is your input. Let us know what you think. We can
  509. address it in WINDOID or perhaps the next revision of HyperCard. You can make a
  510. difference in the world by communicating with us. Dont pass up the
  511. opportunity!
  512.  
  513. The form:
  514.  
  515. Please use the following form to make a difference in the world:
  516.  
  517. Date:
  518. Name:
  519. Address:
  520. Phone #:
  521. Versions of:
  522.  a.  HyperCard:
  523.  b.  Associated software:
  524.  c.  System Software:
  525.    1. System
  526.    2. Finder
  527.    3. ImageWriter file
  528.    4. LaserWriter file
  529.    5. Any others
  530. Type of Macintosh:
  531. Peripherals:
  532. Description of problem, suggestions or comments:
  533.  
  534.  
  535. Fill this out and send it to:
  536.  
  537. AHUG
  538. C/O David Leffler
  539. Apple Computer Inc.
  540. MS 27AQ
  541. 20525 Mariani Ave.,
  542. Cupertino, CA  95014
  543.  
  544. Or copy the format and AppleLink it to:
  545.  
  546. HYPERBUG$
  547.  
  548. We thank you for your participation and know that you will be pleased to see
  549. your ideas, comments, and suggestions appear in future issues of WINDOID, the
  550. publication for the informed HyperCard user.
  551.  
  552.  
  553. -- 
  554.  
  555. Apple's HyperCard Grievance Center
  556. "Give us your bugs, your comments, your gentle criticisms..."
  557.  
  558. UUCP:  {pyramid!sun,voder,nsc,ucbvax!mtxinu,dual,decwrl,amdahl}!apple!hyperbug
  559.  
  560.  
  561.